<?php

$_this =& $this;

/* @var $_this View */
/* @var $form FormHelper */
/* @var $editForm EditFormHelper */
/* @var $html HtmlHelper */
/* @var $ehtml EHtmlHelper */
/* @var $javascript JavascriptHelper */
/* @var $jqax JqaxHelper */
/* @var $filterBlock FilterBlock */

$this_user = $mode != 'create' && Auth::o()->is('admin') && (Auth::o()->realId() == $this->data[$modelName][$PKName]);

?><?=$editForm->create($modelName, array('url'=>("/{$url_part}/".($mode == 'create' ? 'new' : $this->data[$modelName][$PKName]).'/'), 'allowInput' => $this->data[$modelName]['__allows']['update']));?><?php

	?><?=$editForm->startSet();?><?php
        if ($mode !== 'create') {
        	?><?=$editForm->datetimeView(__d($po_domain, 'created_field', true), $this->data[$modelName]['created']);?><?php
        }
		?><?=$editForm->select("status", __d($po_domain, 'status', true), $statuses_list, null, array('allowInput'=>!$this_user), false);?><?php
	?><?=$editForm->endSet();?><?php

	?><?=$editForm->startSet();?><?php
		?><?=$editForm->text("username", __d($po_domain, 'username', true), array('required' => true, 'vertical' => false, 'size'=>30));?><?php
		?><?=$editForm->text("name", __d($po_domain, 'name', true), array('required' => false, 'vertical' => false, 'size'=>30));?><?php
        if ($this->data[$modelName]['__allows']['update']) {
    		?><?=$editForm->field("password", __d($po_domain, 'password', true), $form->password('password', array('size'=>30)), array('required' => true, 'vertical' => false));?><?php
    		?><?=$editForm->field("confirm_password", __d($po_domain, 'password_confirm', true), $form->password('confirm_password', array('size'=>30)), array('required' => true, 'vertical' => false));?><?php
        }
	?><?=$editForm->endSet();?><?php

	$buttonsHTML = '';
	$buttonsHTML .= (strlen($buttonsHTML) ? ' ' : '').$editForm->back("/{$url_part}/");
	if ($this->data[$modelName]['__allows']['update']) {
	   $buttonsHTML .= (strlen($buttonsHTML) ? ' ' : '').$editForm->submit(__d(null, ($mode == 'create' ? 'create' : 'save'), true), array());
	}
	if (strlen($buttonsHTML)) {
    	?><?=$editForm->cell($buttonsHTML);?><?php
	}

?><?=$editForm->end();?><?php

?>
